﻿Imports System.Data.SqlClient

Partial Public Class labo_inscripcion
    Inherits System.Web.UI.Page

    <System.Web.Script.Services.ScriptMethod(), System.Web.Services.WebMethod()> _
    Public Shared Function SearchEstudiante(ByVal prefixText As String, ByVal count As Integer) As List(Of String)
        Dim conn As SqlConnection = New SqlConnection
        conn.ConnectionString = ConfigurationManager.ConnectionStrings("ASI2UFG").ConnectionString
        Dim cmd As SqlCommand = New SqlCommand
        cmd.CommandText = "select CARNET from ESTUDIANTE where" & " CARNET like @SearchText + '%'"
        cmd.Parameters.AddWithValue("@SearchText", prefixText)
        cmd.Connection = conn
        conn.Open()
        Dim customers As List(Of String) = New List(Of String)
        Dim sdr As SqlDataReader = cmd.ExecuteReader
        While sdr.Read
            customers.Add(sdr("CARNET").ToString)
        End While
        conn.Close()
        Return customers
    End Function

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.ANIO.Text = Year(Now)
        Me.txtPersonal.Text = Session("id")

    End Sub

End Class